<?php
namespace app\admin\controller;

use app\common\model\AppleDebtBacked;
use think\admin\Controller;

/**
 * 账单明细
 */
class Log extends Controller
{
    //账单类型
    protected $debtType = [1 => '租金收入', 3 => '意外保障', 4 => '溢价金', 5 => '买断尾款', 8 => '运费金额', 9 => '违约金', 11 => '退款'];

    /**
     * 明细列表
     * @auth true
     * @return void
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function index()
    {
        $this->title = '账单明细';
        $query = AppleDebtBacked::mQuery();
        $user = $this->app->session->get('user');
        if($user['id'] != 10000) $query->where('merchant_id', '=', $user['id']);
        $query->equal('status');
        $query->equal('bill_type');
        $query->like('order_id,shop_name');
        $query->where(['del_flag' => 0]);
        $query->order('gmt_created desc')->page();
    }
}